// mysql_user_storage.hpp
#pragma once

#include "user_storage.hpp"

namespace storage {

class MemUserStorage : public IUserStorage {
public:
    explicit MemUserStorage();
    ~MemUserStorage() override = default;

    bool create_user(const UserEntity& user) override;
    std::optional<UserEntity> get_user_by_username(const std::string& username) override;
    std::optional<UserEntity> get_user_by_id(int64_t user_id) override;
    bool update_user(const UserEntity& user) override;
    bool delete_user(int64_t user_id) override;
    bool exists_by_username(const std::string& username) override;

    // 会话管理
    bool store_session(const UserSession& session) override;
    bool delete_session(const std::string& username) override;
    std::optional<UserSession> get_session(const std::string& username) override;

private:
    // 数据直接存内存
    std::unordered_map<std::string, UserEntity> users_;
    std::unordered_map<std::string, UserSession> sessions_;

    // 其他辅助方法...

};

} // namespace storage